{template 'member', 'header'}
<script type="text/javascript">
<!--
	var charset = '{CHARSET}';
	var uploadurl = '{php echo pc_base::load_config('system','upload_url')}';
//-->
</script>
<div id="memberArea">
	{template 'member', 'left'}
	<div class="col-auto">
	{if $job=='ask'}
		<div class="col-1 ">
			<h5 class="title">修改问题</h5>
			<div class="content">
				
			<table cellpadding="0" cellspacing="0" width="100%" class="table_form">

	<form name="myform" method="post" action="{APP_PATH}index.php?m=ask&c=center&a=edit&job=ask&id={$id}" onSubmit="return checkform(this);">
      <tr>
        <th width="70">您的问题</th>
        <td><input type="text" style="width:400px;" name="info[title]" id="title" value="{$title}"  class="measure-input " onBlur="$.post('api.php?op=get_keywords&number=3&sid='+Math.random()*5, {data:$('#title').val()}, function(data){if(data && $('#keywords').val()=='') $('#keywords').val(data); })" onkeyup="strlen_verify(this, 'title_len', 80);"/><input type="hidden" name="style_color" id="style_color" value="">
		<input type="hidden" name="style_font_weight" id="style_font_weight" value="">还可输入<B><span id="title_len">80</span></B> 个字符</td>
		<script language="javascript" type="text/javascript" src="{JS_PATH}content_addtop.js"></script>

      </tr>
      <tr>
        <th style="vertical-align:top">问题补充</th>
        <td><textarea name="message" id="message" rows="15" cols="60" style="width:96%;" >{$message}</textarea>
		{if $M[use_editor]}{form::editor('message','basic','ask', $catid, '', 0, 0,0,300,0, 0)}{/if}
        </td>
      </tr>
      <tr>
		<th>栏目:</th>
		<td>
		<input type="hidden" name="info[catid]" id="catid" value="{$catid}">
		<span onclick="this.style.display='none';$('#reselect_catid').show();" style="cursor:pointer;">{$CATEGORYS[$catid][catname]} <font color="red">点击重选</font></span>
		<span id="reselect_catid" style="display:none;">
		<span id="load_catid"></span>
		<a href="javascript:category_reload();">{L('reselect')}></a>
		</span>
<script type="text/javascript"> 
		function category_load(id)
		{
			$.get('?m=ask&c=load&a=category&pc_hash={$pc_hash}', { field: 'catid', id: id, value: 'catid' },
				  function(data){
					$('#load_catid').append(data);
				  });
		}
		function category_reload()
		{
			$('#load_catid').html('');
			category_load(0);
		}
		category_load(0);
</script>
		</td>
	</tr>

      <tr>
        <th>悬赏积分</th>
        <td><select name="info[reward]" id="reward"  onchange="ckreward();">
	<option value=0 {if $reward=='0'}selected{/if}>0</option>
	<option value=5 {if $reward=='5'}selected{/if}>5</option>
	<option value=10 {if $reward=='10'}selected{/if}>10</option>
	<option value=15 {if $reward=='15'}selected{/if}>15</option>
	<option value=20 {if $reward=='20'}selected{/if}>20</option>
	<option value=30 {if $reward=='30'}selected{/if}>30</option>
	<option value=45 {if $reward=='45'}selected{/if}>45</option>
	<option value=60 {if $reward=='60'}selected{/if}>60</option>
	<option value=80 {if $reward=='80'}selected{/if}>80</option>
	<option value=100 {if $reward=='100'}selected{/if}>100</option>
</select>( 注：您目前的总积分为：{$_point} )
<span id="reward_msg"></span></td>
      </tr>
      <tr>
        <th>匿名设定</th>
        <td><input type="checkbox" id="anonymity" onclick="checkAnonymity();" name="info[anonymity]" value="1" {if $anonymity=='1'}checked{/if}>您可以对问题设定匿名，但您需要付出积分{$M[anybody_score]}分。<span id="anonymity_msg"></span></td>
      </tr>
      {if $M[publish_code]}
      <tr>
  	    <th>验证码</th>
    	<td><input type="text" name="code"  class="input-text" id="yzmText"  />{form::checkcode('','','14','110','30')}</td>
      </tr>
      {/if}
      <tr>
        <th></th>
        <td>
		<input type="hidden" name="id" value="{$id}" />
		<input type="hidden" name="action" value="edit">
		<input type="hidden" name="job" value="{$job}">
		<input name="dosubmit" type="submit" value="好了，提交" /></td>
      </tr>
	  </form>
    </table>

			</div>
			<span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span>
		</div>
{else}
<div class="col-1 ">
			<h5 class="title">修改答案</h5>
			<div class="content">
				
			<table cellpadding="0" cellspacing="0" width="100%" class="table_form">

	<form name="myform" method="post" action="{APP_PATH}index.php?m=ask&c=center&a=edit&id={$id}&pid={$pid}">
      <tr>
        <th width="70">问题</th>
        <td>{$title}</td>

      </tr>
      <tr>
        <th style="vertical-align:top">我的回答</th>
        <td><textarea name="message" id="message" rows="15" cols="60" style="width:96%;" >{$message}</textarea>
		{if $M[use_editor]}{form::editor('message','introduce','100%',200,0)}{/if}
        </td>
      </tr>

      {if $M[answer_code]}
      <tr>
  	    <th>验证码</th>
    	<td><input type="text" name="code"  class="input-text" id="yzmText"  />{form::checkcode('','','14','110','30')}</td>
      </tr>
      {/if}
      <tr>
        <th></th>
        <td>
		<input type="hidden" name="id" value="{$id}" />
		<input type="hidden" name="pid" value="{$pid}" />
		<input type="hidden" name="action" value="edit">
		<input type="hidden" name="job" value="{$job}">
		<input name="dosubmit" type="submit" value="好了，提交" /></td>
      </tr>
	  </form>
    </table>

			</div>
			<span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span>
		</div>
{/if}	
	
	</div>
</div>
<div class="clear"></div>
<script type="text/javascript">
<!--
function hide_code() {
	if ($('#yzmText').data('hide')==0) {
		$('#yzm').hide();
	}
}
function on_submit() {
	$('#loading').show();
	return true;        
}

var maxlimit=10000;
$('#message').keyup(function() {
	{if !$_userid}redirect('{APP_PATH}index.php?m=member&c=index&a=login&forward={urlencode(get_url())}');{/if}
	data = document.getElementById("message").value.length;
	if (data > maxlimit)
	{
		alert("问题补充不能超过1000字");
		document.getElementById("message").value = document.getElementById("message").value.substring(0, maxlimit);
		return false;
	}
	return true;
});

function ckreward()
{
	if($('#reward').val() != "" && $('#reward').val() > {$_point})
	{
		$('#reward_msg').html("<font color='red'><strong>抱歉,悬赏不能高于您目前的总积分.</strong></font>");
		return false;
	}
	else
	{
		$('#reward_msg').html("");
		return true;
	}
}
function checkAnonymity()
{
	if($('#anonymity').attr('checked')==true)
	{
		var _points = {$_point};
		if(_points < {$M[anybody_score]})
		{
			$('#anonymity_msg').html("<font color='red'><strong>抱歉,您的积分不足以设置匿名.</strong></font>");
			$('#anonymity').attr('checked',false);
		}
	}
}

function checkform()
{
	if($('#title').val() == '')
	{
		alert("标题不能为空");
		$('#title').focus();
		return false;
	}
	if($('#catid').val() == 0)
	{
		alert("请选择分类");
		$('#catid').focus();
		return false;
	}
	if($('#reward').val() != "" && $('#reward').val() > {$_point})
	{
		alert("抱歉,悬赏不能高于您目前的总积分");
		return false;
	}
}
//-->
</script>
{template 'member', 'footer'}